<?php

namespace app\common\model\xiservice;

use think\Model;


class Refund extends Model
{

    

    

    // 表名
    protected $name = 'xiservice_order_refund';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'stauts_text'
    ];
    

    
    public function getStautsList()
    {
        return ['0' => __('Stauts 0'), '1' => __('Stauts 1'), '2' => __('Stauts 2'), '3' => __('Stauts 3')];
    }


    public function getStautsTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['stauts']) ? $data['stauts'] : '');
        $list = $this->getStautsList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function order()
    {
        return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function service()
    {
        return $this->belongsTo('Service', 'service_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function user()
    {
        return $this->belongsTo('User', 'user_id', 'user_id', [], 'LEFT')->setEagerlyType(0);
    }
}
